package com.bdqn.service;

import com.bdqn.entity.User;
import com.bdqn.repository.UserRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;


@RunWith(SpringRunner.class)
@SpringBootTest
public class UserRepositoryTester {
    @Resource
    private UserRepository userRepository;
    @Test
    public void testInsert(){
        User user=new User("JPA","123456",8L,1);
        userRepository.save(user);
    }
    @Test
    public void testGet(){

        User user = userRepository.findById(2L).get();
        System.out.println("userName:"+user.getUserName());
    }
}
